//导入axios实例
import { instance } from "@/request"
// 封装http请求
class Http {
  static BASE_URL = "http://192.168.1.13:3000"

  static getHttp(url) {
    return new Promise((resolve, reject) => {
      instance.get(this.BASE_URL + url).then((res) => {
        resolve(res)
      })
    })
  }
  static postHttp(url, msg) {
    return new Promise((resolve, reject) => {
      instance.post(this.BASE_URL + url, msg).then((res) => {
        resolve(res)
      })
    })
  }
  //添加事件
  static addEvent(msg) {
    return this.postHttp(`/back/event`, msg)
  }
  //查看最新公告
  static getNoticeLatest() {
    return this.getHttp(`/notice/latest`)
  }
  //查看所有公告
  static getAllNotice() {
    return this.getHttp(`/notice/getAll`)
  }
}

export { Http }
